import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:surfaceim/common/values/colors.dart';
import 'package:surfaceim/pages/application/controller.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';

class HomePage extends StatelessWidget {
  ApplicationController applicationController =
      Get.find<ApplicationController>();

  @override
  Widget build(BuildContext context) {
    return ListView(
      children: [
        Container(
          color: AppColors.secondaryBackground,
          padding: EdgeInsets.all(30.w),
          child: Column(
            // crossAxisAlignment: CrossAxisAlignment.center,
            // mainAxisAlignment: MainAxisAlignment.start,
            children: [
              //图片部分
              Stack(
                children: [
                  Container(
                      decoration: BoxDecoration(
                          image: DecorationImage(
                              fit: BoxFit.cover,
                              image: AssetImage(
                                "assets/images/meinv.jpeg",
                              )),
                          borderRadius:
                              BorderRadius.all(Radius.circular(12.h))),
                      height: 670.h),
                  Container(
                    width: 203.w,
                    height: 56.h,
                    margin: EdgeInsets.all(28.w),
                    decoration: BoxDecoration(
                        borderRadius: BorderRadius.all(Radius.circular(28.h)),
                        color: Color.fromRGBO(0, 0, 0, 0.35)),
                    child: Column(
                      crossAxisAlignment: CrossAxisAlignment.center,
                      mainAxisAlignment: MainAxisAlignment.center,
                      children: [
                        Text(
                          "身份已认证",
                          style:
                              TextStyle(color: Colors.white, fontSize: 24.sp),
                        )
                      ],
                    ),
                  )
                ],
              ),

              // 信息概览
              Container(
                padding: EdgeInsets.all(30.w),
                decoration: BoxDecoration(
                    borderRadius: BorderRadius.all(Radius.circular(12.w)),
                    color: Color.fromRGBO(255, 255, 255, 1)),
                // width: 670.w,
                margin: EdgeInsets.only(top: 30.w),
                child: Column(
                  crossAxisAlignment: CrossAxisAlignment.start,
                  children: [
                    Obx(() {
                      return Row(
                        mainAxisAlignment: MainAxisAlignment.spaceBetween,
                        children: [
                          Row(children: [
                            Text(applicationController.schoolName.value),
                            Container(
                              width: 18.w,
                            ),
                            Text(applicationController.degree.value)
                          ]),
                          Text(applicationController.degreeType.value)
                        ],
                      );
                    }),
                    Container(height: 30.h),
                    Row(
                      mainAxisAlignment: MainAxisAlignment.spaceBetween,
                      crossAxisAlignment: CrossAxisAlignment.center,
                      children: [
                        Text(
                          "Daniel",
                          style: TextStyle(fontSize: 53.sp),
                        ),
                        Row(
                          children: [
                            Obx(() => Text(applicationController.address.value,
                                style: TextStyle(fontSize: 26.sp)))
                          ],
                        )
                      ],
                    ),
                    Container(height: 20.h),
                    Row(
                      children: [
                        Obx(() => Text(applicationController.age.value,
                            style: TextStyle(fontSize: 26.sp))),
                        Container(
                          width: 10.w,
                        ),
                        Text("|", style: TextStyle(fontSize: 26.sp)),
                        Container(
                          width: 10.w,
                        ),
                        Obx(() => Text(applicationController.height.value,
                            style: TextStyle(fontSize: 26.sp))),
                        Container(
                          width: 10.w,
                        ),
                        Text("|", style: TextStyle(fontSize: 26.sp)),
                        Container(
                          width: 10.w,
                        ),
                        Obx(() => Text(
                            applicationController.constellation.value,
                            style: TextStyle(fontSize: 26.sp)))
                      ],
                    ),
                    Obx(() {
                      List<Widget> list = List.empty(growable: true);
                      for (var i = 0;
                          i < applicationController.tags.value.length;
                          i++) {
                        list.add(
                          Container(
                            padding: EdgeInsets.only(
                              left: 25.h,
                              right: 25.h,
                              top: 10.h,
                              bottom: 10.h,
                            ),
                            margin: i == 0
                                ? EdgeInsets.only(top: 19.h)
                                : EdgeInsets.only(top: 19.h, left: 14.w),
                            decoration: BoxDecoration(
                                borderRadius:
                                    BorderRadius.all(Radius.circular(8.w)),
                                color: Color.fromRGBO(254, 241, 244, 1)),
                            child: Text(
                              applicationController.tags.value[i],
                              style: TextStyle(
                                  fontSize: 26.sp,
                                  color: Color.fromRGBO(250, 135, 159, 1)),
                            ),
                          ),
                        );
                      }
                      return Wrap(
                        children: list,
                      );
                    }),
                  ],
                ),
              ),

              //关于我  心仪的他等信息
              Obx(() {
                List<Widget> list = List.empty(growable: true);
                for (int i = 0;
                    i <
                        applicationController.expectInfo.value.keys
                            .toList()
                            .length;
                    i++) {
                  list.add(Container(
                      padding: EdgeInsets.all(30.h),
                      // width: ScreenUtil().setWidth(670),
                      margin: EdgeInsets.only(top: 30.h),
                      decoration: BoxDecoration(
                          borderRadius: BorderRadius.all(Radius.circular(12.w)),
                          color: Color.fromRGBO(255, 255, 255, 1)),
                      child: Column(
                        crossAxisAlignment: CrossAxisAlignment.start,
                        children: [
                          Text(
                              applicationController.expectInfo.value.keys
                                  .toList()[i],
                              style: TextStyle(
                                  fontSize: 26.sp,
                                  fontWeight: FontWeight.w600,
                                  color: Color.fromRGBO(51, 51, 51, 1))),
                          Container(
                            height: 28.h,
                          ),
                          Text(
                            applicationController.expectInfo.value[
                                applicationController.expectInfo.value.keys
                                    .toList()[i]],
                            style: TextStyle(
                                fontSize: 28.sp,
                                color: Color.fromRGBO(51, 51, 51, 1)),
                          )
                        ],
                      )));
                }
                return Column(
                  children: list,
                );
              }),
            ],
          ),
        )
      ],
    );
  }
}
